Add Paykit integration module (Phase 3.1)#524
Closed
BitcoinErrorLog wants to merge 2 commits into
Closed
Conversation
added 2 commits
December 14, 2025 17:47
- Document LightningRepo and WalletRepo integration points - Map Paykit executor methods to Bitkit APIs - Document suspend/sync bridging patterns - Document error handling with Result<T> pattern - Document network configuration mapping - Outline payment completion polling strategy - Document dependency injection setup
Implements the core Paykit integration components: - PaykitManager: Singleton managing PaykitClient lifecycle and executor registration. Maps LDK Network to Paykit network configs. Uses Mutex for thread-safe initialization. - BitkitBitcoinExecutor: Implements BitcoinExecutorFFI, bridging LightningRepo.sendOnChain() to Paykit's onchain payment interface. Uses runBlocking with Dispatchers.IO for coroutine-to-sync bridging. - BitkitLightningExecutor: Implements LightningExecutorFFI, bridging LightningRepo.payInvoice() to Paykit. Includes payment completion polling to extract preimage proof, SHA-256 verification. - PaykitIntegrationHelper: Convenience methods for setup and payment execution with async callback support. Note: PaykitMobile bindings (UniFFI generated) must be linked before these components are fully functional. TODOs mark where binding code should be uncommented once available.
There was a problem hiding this comment.
detekt found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the core Paykit integration module for Bitkit Android:
PaykitManager: Singleton managing PaykitClient lifecycle and executor registration. Maps
LDK Networkto Paykit network configs (MAINNET/TESTNET/REGTEST/SIGNET). UsesMutexfor thread-safe coroutine initialization.BitkitBitcoinExecutor: Implements
BitcoinExecutorFFI, bridgingLightningRepo.sendOnChain()to Paykit's onchain payment interface. UsesrunBlocking(Dispatchers.IO)withwithTimeoutfor coroutine-to-sync FFI bridging.BitkitLightningExecutor: Implements
LightningExecutorFFI, bridgingLightningRepo.payInvoice()to Paykit. Includes payment completion polling viagetPayments(), SHA-256 preimage verification, and hex encoding utilities.PaykitIntegrationHelper: Convenience methods for setup and payment execution, with both suspend and callback-based async APIs.
Key Features
Env.networkto Paykit's network enumsrunBlockingwithDispatchers.IOand timeouts for sync FFI callsLightningRepo.getPayments()to retrieve payment status and preimageMutexfor thread-safe initializationPaykitManagerannotated with@Singletonand@InjectPrerequisites
PaykitMobile UniFFI bindings must be generated and linked before these components are fully functional. TODOs in the code mark where binding code should be uncommented.
Test plan
cargo build --features mobilePaykitIntegrationHelper.setup(lightningRepo)during app startup